package com.info.zhiduoduo.repository.mapper.report;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.info.zhiduoduo.repository.entity.report.DailyReport;
import com.info.zhiduoduo.repository.entity.report.DailyReportDto;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author bob
 * @since 2020-07-19
 */
public interface DailyReportMapper extends BaseMapper<DailyReport> {

	@Select(" select * from zdd_daily_report " +
			" where IF(ISNULL(#{from}), 1=1, DATE(`date`) >= DATE(#{from})) " +
			" and IF(ISNULL(#{to}), 1=1, DATE(`date`) <= DATE(#{to})) " +
			" order by id desc ")
	List<DailyReportDto> listReport(@Param("from") Date from, @Param("to") Date to);
}
